﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EIS_desktop
{
    public partial class CollegeInformation : Form
    {
        public CollegeInformation()
        { 
            InitializeComponent();
        }

        private void textBoxFN_Validating(object sender, CancelEventArgs e)
        {
            if (textBoxFN.Text == "")
            {
                errorProvider1.SetError(textBoxFN, "Please Enter First Name");
            }
            else
            {
                errorProvider1.SetError(textBoxFN, "");
            }
        }

        private void textBoxLN_Validating(object sender, CancelEventArgs e)
        {
            if (textBoxLN.Text == "")
            {
                errorProvider1.SetError(textBoxLN, "Please Enter Last Name");
            }
            else
            {
                errorProvider1.SetError(textBoxLN, "");
            }
        }

        private void textBoxCN_Validating(object sender, CancelEventArgs e)

        {
            if (textBoxCN.Text == "")
            {
                errorProvider1.SetError(textBoxCN, " Enter College Name");
            }
            else
            {
                errorProvider1.SetError(textBoxCN, "");
            }

        }

        private void textBoxCA_Validating(object sender, CancelEventArgs e)
        {
            if (textBoxCA.Text == "")
            {
                errorProvider1.SetError(textBoxCA,  "Enter College Address");
            }
            else
            {
                errorProvider1.SetError(textBoxCA, "");
            }

        }

        private void textBoxDN_Validating(object sender, CancelEventArgs e)
        {
            if (textBoxDN.Text == "")
            {
                errorProvider1.SetError(textBoxDN, "Please Enter Name ");
            }
            else
            {
                errorProvider1.SetError(textBoxDN, "");
            }

        }

        private void textBoxDPN_Validating(object sender, CancelEventArgs e)
        {
            System.Text.RegularExpressions.Regex rphn=new System.Text.RegularExpressions.Regex(@"^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$");
            if (!rphn.IsMatch(textBoxDPN.Text))
            {
                errorProvider1.SetError(textBoxDPN, "enter phone number in US format,e.g (777)777-7777 or (777) 777-7777");
            }
            else
            {
                errorProvider1.SetError(textBoxDPN, "");
            }
            


        }

        private void textBoxDEM_Validating(object sender, CancelEventArgs e)
        {
            System.Text.RegularExpressions.Regex rEMail = new System.Text.RegularExpressions.Regex(@"^[a-zA-Z][\w\._]{2,28}[a-zA-Z0-9]@[a-zA-Z0-9][\w\._]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
           // if (textBoxDEM.Text.Length > 0)
            //{
                if (!rEMail.IsMatch(textBoxDEM.Text))
                {
                    errorProvider1.SetError(textBoxDEM, "Enter Correct Format,freerhyme@abc.com");
                }
                else
                {
                    errorProvider1.SetError(textBoxDEM, "");
                }
           // }
        }

        private void textBoxSSNN_Validating(object sender, CancelEventArgs e)
        {
            System.Text.RegularExpressions.Regex rssnn=new System.Text.RegularExpressions.Regex(@"^\d{3}\-?\d{2}\-?\d{4}$");
             if(!rssnn.IsMatch(textBoxSSNN.Text))
             {
                 errorProvider1.SetError(textBoxSSNN,"Invalid SSN, e.g 222-22-2222 or 222222222");
             }
             else
             {
                 errorProvider1.SetError(textBoxSSNN,"");
             }
           
              
        }

        private void textBoxDLA_Validating(object sender, CancelEventArgs e)
        {
            if (textBoxDLA.Text == "")
            {
                errorProvider1.SetError(textBoxDLA, "Please Enter Licence Address");
            }
            else
            {
                errorProvider1.SetError(textBoxDLA, "");
            }

        }

        private void textBoxAddr_Validating(object sender, CancelEventArgs e)
        {
            if (textBoxAddr.Text == "")
            {
                errorProvider1.SetError(textBoxAddr, "Please Enter SSN Address");
            }
            else
            {
                errorProvider1.SetError(textBoxAddr, "");
            }

        }

        private void textBoxResAddr_Validating(object sender, CancelEventArgs e)
        {
            if (textBoxResAddr.Text == "")
            {
                errorProvider1.SetError(textBoxResAddr, " Enter Residence Address");
            }
            else
            {
                errorProvider1.SetError(textBoxResAddr, "");
            }
        }

        private void textBoxEmp_Validating(object sender, CancelEventArgs e)
        {
            if (textBoxEmp.Text == "")
            {
                errorProvider1.SetError(textBoxEmp, "please fill Employer");
            }
            else
            {
                errorProvider1.SetError(textBoxEmp, "");
            }
        }
        }

       
}
